home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume2 / xbrowser / part03 < prev    next >
Encoding:
Internet Message Format  |  1989-01-03  |  38.0 KB

  1. Path: uunet!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v02i071:  a browser, Part03/03
  5. Message-ID: <1955@wyse.wyse.com>
  6. Date: 3 Jan 89 20:53:58 GMT
  7. Organization: Wyse Technology, San Jose
  8. Lines: 1305
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by:  Schlichter.Wbst@Xerox.COM (Hans Schlichter)
  12. Posting-number: Volume 2, Issue 71
  13. Archive-name: xbrowser/part03
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 3 (of 3)."
  22. # Contents:  AUTHOR Imakefile Makefile ap.c list.c option.h optionP.h
  23. #   toggle.h toggleP.h xbrowser.icon xfilebrowser.h
  24. # Wrapped by mikew@wyse on Tue Jan  3 12:03:49 1989
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'AUTHOR' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'AUTHOR'\"
  28. else
  29. echo shar: Extracting \"'AUTHOR'\" \(491 characters\)
  30. sed "s/^X//" >'AUTHOR' <<'END_OF_FILE'
  31. XReturn-Path: Schlichter.Wbst@Xerox.COM
  32. XReceived:  by wyse.wyse.com (5.58/Wyse master/5-13-88)
  33. X    id AA13290; Tue, 3 Jan 89 11:13:22 PST
  34. XFrom: Schlichter.Wbst@Xerox.COM
  35. XReceived: from Xerox.COM by uunet.UU.NET (5.59/1.14) 
  36. X    id AA11840; Tue, 3 Jan 89 13:01:45 EST
  37. XReceived: from Catawba.ms by ArpaGateway.ms ; 03 JAN 89 09:58:01 PST
  38. XDate: 3 Jan 89 12:57:28 EST (Tuesday)
  39. XSubject: xbrowser.shar.part1.Z
  40. XTo: x-sources@wyse.com
  41. XCc: Schlichter.Wbst@Xerox.COM
  42. XMessage-Id: <890103-095801-1304@Xerox>
  43. X
  44. END_OF_FILE
  45. if test 491 -ne `wc -c <'AUTHOR'`; then
  46.     echo shar: \"'AUTHOR'\" unpacked with wrong size!
  47. fi
  48. # end of 'AUTHOR'
  49. fi
  50. if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  51.   echo shar: Will not clobber existing file \"'Imakefile'\"
  52. else
  53. echo shar: Extracting \"'Imakefile'\" \(434 characters\)
  54. sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
  55. X#ifdef BandAidCompiler
  56. X#include BandAidCompiler
  57. X#endif
  58. X
  59. XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  60. X
  61. X           SRCS = ap.c commands.c list.c modcommand.c option.c \
  62. X        popup.c scandir.c search.c toggle.c util.c \
  63. X        xfilebrowser.c
  64. X           OBJS = ap.o commands.o list.o modcommand.o option.o \
  65. X        popup.o scandir.o search.o toggle.o util.o \
  66. X        xfilebrowser.o
  67. X
  68. XComplexProgramTarget(xbrowser)
  69. XInstallAppDefaults(Xbrowser)
  70. END_OF_FILE
  71. if test 434 -ne `wc -c <'Imakefile'`; then
  72.     echo shar: \"'Imakefile'\" unpacked with wrong size!
  73. fi
  74. # end of 'Imakefile'
  75. fi
  76. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  77.   echo shar: Will not clobber existing file \"'Makefile'\"
  78. else
  79. echo shar: Extracting \"'Makefile'\" \(6752 characters\)
  80. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  81. X# Makefile generated by imake - do not edit!
  82. X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $
  83. X#
  84. X# The cpp used on this machine replaces all newlines and multiple tabs and
  85. X# spaces in a macro expansion with a single space.  Imake tries to compensate
  86. X# for this, but is not always successful.
  87. X#
  88. X
  89. X###########################################################################
  90. X# X Window System Makefile generated from template file Imake.tmpl
  91. X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $
  92. X#
  93. X# Do not change the body of the imake template file.  Server-specific
  94. X# parameters may be set in the appropriate .macros file; site-specific
  95. X# parameters (but shared by all servers) may be set in site.def.  If you
  96. X# make any changes, you'll need to rebuild the makefiles using
  97. X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in
  98. X# the top level directory.
  99. X#
  100. X# If your C preprocessor doesn't define any unique symbols, you'll need
  101. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  102. X# "make Makefile", "make Makefiles", or "make World").
  103. X#
  104. X# If you absolutely can't get imake to work, you'll need to set the
  105. X# variables at the top of each Makefile as well as the dependencies at the
  106. X# bottom (makedepend will do this automatically).
  107. X#
  108. X
  109. X###########################################################################
  110. X# platform-specific configuration parameters - edit Sun.macros to change
  111. X
  112. X# platform:  $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $
  113. X# operating system:   SunOS 3.4
  114. X
  115. XBOOTSTRAPCFLAGS =
  116. X             AS = as
  117. X             CC = cc
  118. X            CPP = /lib/cpp
  119. X             LD = ld
  120. X           LINT = lint
  121. X        INSTALL = install
  122. X           TAGS = ctags
  123. X             RM = rm -f
  124. X             MV = mv
  125. X             LN = ln -s
  126. X         RANLIB = ranlib
  127. XRANLIBINSTFLAGS = -t
  128. X             AR = ar clq
  129. X             LS = ls
  130. X       LINTOPTS = -axz
  131. X    LINTLIBFLAG = -C
  132. X           MAKE = make
  133. XSTD_CPP_DEFINES =
  134. X    STD_DEFINES =
  135. X
  136. X###########################################################################
  137. X# site-specific configuration parameters - edit site.def to change
  138. X
  139. X# site:  $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $
  140. X
  141. X###########################################################################
  142. X# definitions common to all Makefiles - do not edit
  143. X
  144. X          SHELL =  /bin/sh
  145. X
  146. X        DESTDIR = /global
  147. X      USRLIBDIR = $(DESTDIR)/lib
  148. X         BINDIR = $(DESTDIR)/bin/X11
  149. X         INCDIR = $(DESTDIR)/include
  150. X         ADMDIR = $(DESTDIR)/usr/adm
  151. X         LIBDIR = $(USRLIBDIR)/X11
  152. X     LINTLIBDIR = $(USRLIBDIR)/lint
  153. X        FONTDIR = $(LIBDIR)/fonts
  154. X       XINITDIR = $(LIBDIR)/xinit
  155. X         XDMDIR = $(LIBDIR)/xdm
  156. X         UWMDIR = $(LIBDIR)/uwm
  157. X         AWMDIR = $(LIBDIR)/awm
  158. X         TWMDIR = $(LIBDIR)/twm
  159. X          DTDIR = $(LIBDIR)/dt
  160. X        MANPATH = /usr/man
  161. X  MANSOURCEPATH = $(MANPATH)/man
  162. X         MANDIR = $(MANSOURCEPATH)n
  163. X      LIBMANDIR = $(MANSOURCEPATH)n3
  164. X    XAPPLOADDIR = $(LIBDIR)/app-defaults
  165. X
  166. X   INSTBINFLAGS = -m 0755
  167. X   INSTUIDFLAGS = -m 4755
  168. X   INSTLIBFLAGS = -m 0664
  169. X   INSTINCFLAGS = -m 0444
  170. X   INSTMANFLAGS = -m 0444
  171. X   INSTAPPFLAGS = -m 0444
  172. X  INSTKMEMFLAGS = -m 4755
  173. X        FCFLAGS = -t
  174. X    CDEBUGFLAGS = -O
  175. X
  176. X        PATHSEP = /
  177. X         DEPEND = $(BINDIR)/makedepend
  178. X          IMAKE = $(BINDIR)/imake
  179. X            RGB = $(LIBDIR)/rgb
  180. X             FC = $(BINDIR)/bdftosnf
  181. X      MKFONTDIR = $(BINDIR)/mkfontdir
  182. X      MKDIRHIER = $(BINDIR)/mkdirhier.sh
  183. X
  184. X         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
  185. X      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
  186. X        LDFLAGS = $(CDEBUGFLAGS) -L$(USRLIBDIR) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
  187. X
  188. X       IRULESRC = $(LIBDIR)/imake.includes
  189. X
  190. X   EXTENSIONLIB = $(USRLIBDIR)/libext.a
  191. X           XLIB = $(USRLIBDIR)/libX11.a
  192. X         XMULIB = $(USRLIBDIR)/libXmu.a
  193. X        OLDXLIB = $(USRLIBDIR)/liboldX.a
  194. X       XTOOLLIB = $(USRLIBDIR)/libXt.a
  195. X         XAWLIB = $(USRLIBDIR)/libXaw.a
  196. X       LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
  197. X        LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
  198. X      LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
  199. X        LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
  200. X       INCLUDES = -I$(INCDIR)
  201. X      MACROFILE = Sun.macros
  202. X   ICONFIGFILES = $(IRULESRC)/Imake.tmpl \
  203. X            $(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def
  204. X  IMAKE_DEFINES =
  205. X      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \
  206. X            -s Makefile $(IMAKE_DEFINES)
  207. X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
  208. X            .emacs_* tags TAGS make.log MakeOut
  209. X
  210. X###########################################################################
  211. X# rules:  $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $
  212. X
  213. X###########################################################################
  214. X# start of Imakefile
  215. X
  216. XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  217. X
  218. X           SRCS = ap.c commands.c list.c modcommand.c option.c \
  219. X        popup.c scandir.c search.c toggle.c util.c \
  220. X        xfilebrowser.c
  221. X           OBJS = ap.o commands.o list.o modcommand.o option.o \
  222. X        popup.o scandir.o search.o toggle.o util.o \
  223. X        xfilebrowser.o
  224. X
  225. X PROGRAM = xbrowser
  226. X
  227. Xall:: xbrowser
  228. X
  229. Xxbrowser: $(OBJS) $(LOCAL_LIBRARIES)
  230. X    $(RM) $@
  231. X    $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES)
  232. X
  233. Xrelink::
  234. X    $(RM) $(PROGRAM)
  235. X    $(MAKE) $(MFLAGS) $(PROGRAM)
  236. X
  237. Xinstall:: xbrowser
  238. X    $(INSTALL) -c $(INSTALLFLAGS) xbrowser $(BINDIR)
  239. X
  240. Xinstall.man:: xbrowser.man
  241. X    $(INSTALL) -c $(INSTMANFLAGS) xbrowser.man $(MANDIR)/xbrowser.n
  242. X
  243. Xdepend:: $(DEPEND)
  244. X
  245. Xdepend::
  246. X    $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
  247. X
  248. X$(DEPEND):
  249. X    @echo "making $@"; \
  250. X    cd $(DEPENDSRC); $(MAKE)
  251. X
  252. Xclean::
  253. X    $(RM) $(PROGRAM)
  254. X
  255. Xinstall:: Xbrowser.ad
  256. X    $(INSTALL) -c $(INSTAPPFLAGS) Xbrowser.ad $(XAPPLOADDIR)/Xbrowser
  257. X
  258. X###########################################################################
  259. X# Imake.tmpl common rules for all Makefiles - do not edit
  260. X
  261. Xemptyrule::
  262. X
  263. Xclean::
  264. X    $(RM_CMD) \#*
  265. X
  266. XMakefile:: $(IMAKE)
  267. X
  268. XMakefile:: Imakefile \
  269. X    $(IRULESRC)/Imake.tmpl \
  270. X    $(IRULESRC)/Imake.rules \
  271. X    $(IRULESRC)/site.def \
  272. X    $(IRULESRC)/$(MACROFILE)
  273. X    -@if [ -f Makefile ]; then \
  274. X    echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
  275. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  276. X    else exit 0; fi
  277. X    $(IMAKE_CMD) -DTOPDIR=$(TOP)
  278. X
  279. X$(IMAKE):
  280. X    @echo "making $@"; \
  281. X    cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)
  282. X
  283. Xtags::
  284. X    $(TAGS) -w *.[ch]
  285. X    $(TAGS) -xw *.[ch] > TAGS
  286. X
  287. X###########################################################################
  288. X# empty rules for directories that do not have SUBDIRS - do not edit
  289. X
  290. Xinstall::
  291. X    @echo "install done"
  292. X
  293. Xinstall.man::
  294. X    @echo "install.man done"
  295. X
  296. XMakefiles::
  297. X
  298. X###########################################################################
  299. X# dependencies generated by makedepend
  300. X
  301. END_OF_FILE
  302. if test 6752 -ne `wc -c <'Makefile'`; then
  303.     echo shar: \"'Makefile'\" unpacked with wrong size!
  304. fi
  305. # end of 'Makefile'
  306. fi
  307. if test -f 'ap.c' -a "${1}" != "-c" ; then 
  308.   echo shar: Will not clobber existing file \"'ap.c'\"
  309. else
  310. echo shar: Extracting \"'ap.c'\" \(3558 characters\)
  311. sed "s/^X//" >'ap.c' <<'END_OF_FILE'
  312. X/* Systems Sciences Laboratory, Webster Research Center */
  313. X
  314. Xstatic char *PROGRAM_information[] =
  315. X{
  316. X    "Copyright (c) 1988 Xerox Corporation.  All rights reserved.",
  317. X    "$Header$",
  318. X    "$Locker$"
  319. X}
  320. X;
  321. X
  322. X/*
  323. X * Copyright protection claimed includes all forms and matters of copyrightable
  324. X * material and information now allowed by statutory or judicial lay or
  325. X * herinafter granted, including without limitation, material generated from
  326. X * the software programs which are displayed on the screen such as icons,
  327. X * screen display looks, etc.
  328. X */
  329. X
  330. X
  331. X#include "xfilebrowser.h"
  332. X
  333. X#define chunk 2048
  334. X
  335. Xtypedef struct {
  336. X    char *buf;
  337. X    int size;
  338. X    XtTextPosition pos;
  339. X    XtTextSource strSrc;
  340. X} ApAsSourceData;
  341. X
  342. X/* Private Routines */
  343. X
  344. X
  345. Xstatic XtTextPosition ApAsGetLastPos(src)
  346. X  XtTextSource src;
  347. X{
  348. X  ApAsSourceData *data;
  349. X    data = (ApAsSourceData *)src->data;
  350. X    return (XtTextPosition)(*data->strSrc->GetLastPos)(data->strSrc);
  351. X}
  352. X
  353. Xstatic ApAsSetLastPos(src, lastPos)
  354. X  XtTextSource src;
  355. X  XtTextPosition lastPos;
  356. X{
  357. X}
  358. X
  359. Xstatic int ApAsRead(src, pos, text, maxRead)
  360. X  XtTextSource src;
  361. X  int pos;
  362. X  XtTextBlock *text;
  363. X  int maxRead;
  364. X{
  365. X  ApAsSourceData *data;
  366. X    data = (ApAsSourceData *)src->data;
  367. X    return ((*data->strSrc->Read)(data->strSrc, pos, text, maxRead));
  368. X}
  369. X
  370. X
  371. Xstatic Arg stringargs[] = {
  372. X  {XtNstring, (XtArgVal) NULL},
  373. X  {XtNlength, (XtArgVal) NULL},
  374. X  {XtNeditType, (XtArgVal) XttextEdit},
  375. X  };
  376. X
  377. Xstatic int ApAsReplace(src, startPos, endPos, text)
  378. X  XtTextSource src;
  379. X  XtTextPosition startPos, endPos;
  380. X  XtTextBlock *text;
  381. X{
  382. X  ApAsSourceData *data;
  383. X  int i;
  384. X
  385. X    if (!allowedit) return 0;
  386. X    data = (ApAsSourceData *)src->data;
  387. X
  388. X    if((data->pos + text->length) >= data->size){
  389. X        while((data->pos + text->length) >= data->size){
  390. X            data->size += chunk;
  391. X            data->buf = XtRealloc(data->buf, data->size);  /* optimize this!!! */
  392. X        } 
  393. X        XtStringSourceDestroy(data->strSrc);
  394. X    stringargs[0].value = (XtArgVal)data->buf ;
  395. X    stringargs[1].value = (XtArgVal)data->size ;
  396. X        data->strSrc = (XtTextSource)
  397. X          XtStringSourceCreate(toplevel,stringargs,XtNumber(stringargs));
  398. X    }
  399. X    i = (*data->strSrc->Replace)(data->strSrc, startPos, endPos, text);
  400. X    data->pos += text->length;
  401. X    return (i);
  402. X}
  403. X
  404. Xstatic XtTextPosition ApAsScan (src, pos, sType, dir, count, include)
  405. X  XtTextSource src;
  406. X  XtTextPosition pos;
  407. X  XtTextScanType sType;
  408. X  XtTextScanDirection dir;
  409. X  int count, include;
  410. X{
  411. X  ApAsSourceData *data;
  412. X    data = (ApAsSourceData *)src->data;
  413. X    return 
  414. X     ((*data->strSrc->Scan)(data->strSrc, pos, sType, dir, count, include));
  415. X}
  416. X
  417. X
  418. X/* Public routines */
  419. X
  420. XXtTextSource TCreateApAsSource ()
  421. X{
  422. X  XtTextSource src;
  423. X  ApAsSourceData *data;
  424. X    src = (XtTextSource) XtMalloc(sizeof(XtTextSourceRec));
  425. X    src->Read = ApAsRead;
  426. X    src->Replace = ApAsReplace; 
  427. X    src->GetLastPos = ApAsGetLastPos;
  428. X    src->SetLastPos = ApAsSetLastPos;
  429. X    src->Scan = ApAsScan;
  430. X    src->edit_mode = XttextEdit;
  431. X    data = (ApAsSourceData *)(XtMalloc(sizeof(ApAsSourceData)));
  432. X    data->buf = XtCalloc(chunk,1);
  433. X    data->pos = 0;
  434. X    data->size = chunk;
  435. X    stringargs[0].value = (XtArgVal)data->buf ;
  436. X    stringargs[1].value = (XtArgVal)data->size ;
  437. X    data->strSrc = (XtTextSource) XtStringSourceCreate (toplevel,stringargs,
  438. X                   XtNumber(stringargs));
  439. X    src->data = (caddr_t)data;
  440. X    return src;
  441. X}
  442. X
  443. XTDestroyApAsSource(src)
  444. X  XtTextSource src;
  445. X{
  446. X  ApAsSourceData *data;
  447. X    data = (ApAsSourceData *)src->data;
  448. X    XtStringSourceDestroy(data->strSrc);
  449. X    XtFree(data->buf);
  450. X    XtFree(data);
  451. X    XtFree(src);
  452. X}
  453. END_OF_FILE
  454. if test 3558 -ne `wc -c <'ap.c'`; then
  455.     echo shar: \"'ap.c'\" unpacked with wrong size!
  456. fi
  457. # end of 'ap.c'
  458. fi
  459. if test -f 'list.c' -a "${1}" != "-c" ; then 
  460.   echo shar: Will not clobber existing file \"'list.c'\"
  461. else
  462. echo shar: Extracting \"'list.c'\" \(5872 characters\)
  463. sed "s/^X//" >'list.c' <<'END_OF_FILE'
  464. X/* Systems Sciences Laboratory, Webster Research Center */
  465. X
  466. Xstatic char *PROGRAM_information[] =
  467. X{
  468. X    "Copyright (c) 1988 Xerox Corporation.  All rights reserved.",
  469. X    "$Header$",
  470. X    "$Locker$"
  471. X}
  472. X;
  473. X
  474. X/*
  475. X * Copyright protection claimed includes all forms and matters of copyrightable
  476. X * material and information now allowed by statutory or judicial lay or
  477. X * herinafter granted, including without limitation, material generated from
  478. X * the software programs which are displayed on the screen such as icons,
  479. X * screen display looks, etc.
  480. X */
  481. X
  482. X#include <ctype.h>
  483. X#include <pwd.h>
  484. X#include <grp.h>
  485. X
  486. X#include <sys/file.h>
  487. X
  488. X#include "xfilebrowser.h"
  489. X
  490. Xextern char *getenv();
  491. Xextern struct passwd *getpwuid();
  492. Xextern struct passwd *getpwnam();
  493. Xextern struct group *getgrgid();
  494. Xextern struct tm *localtime();
  495. X
  496. X#define HALFYEAR     15000000L
  497. X
  498. Xstatic char *months[] = {
  499. X    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
  500. X    "Nov", "Dec", (char *)NULL };
  501. X
  502. Xstatic struct _pwcache {
  503. X    u_short id;        /* owner or group id */
  504. X    char name[32];
  505. X} ownercache;
  506. X
  507. Xreset_ownercache()
  508. X{
  509. X    ownercache.name[0] = '\0';
  510. X}
  511. X
  512. X/* ARGSUSED */
  513. Xint format_file(i, s, curtime)
  514. Xint i;
  515. Xchar *s;
  516. Xlong curtime;
  517. X{
  518. X    char tmp[64];
  519. X    struct passwd *passname;
  520. X    struct group *groupname;
  521. X    struct tm *actime;
  522. X    struct afile *fp = files[i];
  523. X
  524. X    switch (currentid) {
  525. X    case 2:
  526. X        if (ownercache.name[0] == '\0' || fp->d_gid != ownercache.id) {
  527. X           if ( (groupname = getgrgid(fp->d_gid)) == NULL) {
  528. X               disp_message("\nList: Group of %s not registered",
  529. X               fp->d_name);
  530. X               return(-1);
  531. X           }
  532. X           strcpy(ownercache.name, groupname->gr_name);
  533. X           ownercache.id = fp->d_gid;
  534. X        }
  535. X        break;
  536. X
  537. X    default:
  538. X        if (ownercache.name[0] == '\0' || fp->d_uid != ownercache.id) {
  539. X           if ( (passname = getpwuid(fp->d_uid)) == NULL) {
  540. X                  disp_message("\nList: Owner of %s not registered",
  541. X               fp->d_name);
  542. X                  return(-1);
  543. X           }
  544. X           strcpy(ownercache.name, passname->pw_name);
  545. X           ownercache.id = fp->d_uid;
  546. X        }
  547. X        break;
  548. X    }
  549. X
  550. X    sprintf(s, "%c%s %2d %-8s %8d", 
  551. X        fp->d_type, fp->d_access, fp->d_nlink, ownercache.name,
  552. X        fp->d_size);
  553. X    actime = localtime(&(fp->d_ctime));
  554. X    if ( (curtime - fp->d_ctime) > HALFYEAR)
  555. X        sprintf(tmp, " %-3s %-2d %5d %s\n",
  556. X            months[actime->tm_mon], actime->tm_mday,
  557. X            1900+actime->tm_year, fp->d_name);
  558. X    else     sprintf(tmp, " %-3s %-2d %02d:%02d %s\n",
  559. X            months[actime->tm_mon], actime->tm_mday,
  560. X            actime->tm_hour, actime->tm_min,
  561. X            fp->d_name);
  562. X    strcat(s, tmp);
  563. X    return 0;
  564. X}
  565. X
  566. X#define BUFSIZE 64    /* assume this as normal length of a file format */
  567. X
  568. Xint display_files(position)
  569. Xint position;
  570. X{
  571. X    int i, length, buflength, curlength = 0;
  572. X    long curtime;
  573. X    XtTextBlock text;
  574. X    XtTextPosition start, end, oldend;
  575. X    char *buf;
  576. X    char tmpbuf[2*MAXNAME];
  577. X
  578. X    if (numfiles == 0) {
  579. X       disp_message("\nList: no files found");
  580. X       clear_widget(listwidget, listsource);
  581. X       return(-1);
  582. X    }
  583. X
  584. X    curtime = time(0);
  585. X    oldend = 
  586. X       (*listsource->Scan)(listsource, 0, XtstAll, XtsdRight, 1, 0);
  587. X    XtTextUnsetSelection(listwidget);
  588. X
  589. X    start = 0;
  590. X    buflength = BUFSIZE * numfiles;
  591. X    buf = XtMalloc(buflength);
  592. X    *buf = '\0';
  593. X
  594. X    for (i = 0; i < numfiles; i++) {
  595. X       format_file(i, tmpbuf, curtime);
  596. X       curlength += length = strlen(tmpbuf);
  597. X       if ( (curlength) >= buflength) {
  598. X           buflength += 1096;
  599. X           buf = XtRealloc(buf, buflength);
  600. X       }
  601. X
  602. X       strcat(buf, tmpbuf);
  603. X       files[i]->d_pos1 = start;
  604. X       start = end = start + length;
  605. X       files[i]->d_pos2 = end;
  606. X    }
  607. X
  608. X    allowedit = 1;
  609. X    XtTextDisableRedisplay(listwidget);
  610. X
  611. X    text.length = curlength;
  612. X    text.ptr = buf;
  613. X    text.firstPos = 0;
  614. X    XtTextReplace(listwidget, 0, oldend, &text);
  615. X    allowedit = 0;
  616. X
  617. X    XtFree(buf);
  618. X    XtTextSetInsertionPoint(listwidget, position);
  619. X    XtTextEnableRedisplay(listwidget);
  620. X    return(0);
  621. X}
  622. X
  623. X
  624. X/* ARGSUSED */
  625. Xchar *get_userdir(user)
  626. Xchar *user;
  627. X{
  628. X    struct passwd *object;
  629. X
  630. X    if ( (object = getpwnam(user)) == NULL) {
  631. X       disp_message("\n: user name not found");
  632. X       return(NULL);
  633. X    }
  634. X    else 
  635. X       return(object->pw_dir);
  636. X}
  637. X
  638. X/* ARGSUSED */
  639. Xint separate_dirpat(s, dir, pattern)
  640. Xchar *s, *dir, *pattern;
  641. X{
  642. X        /* if no pattern is found a "*" pattern is returned */
  643. X    int cc;
  644. X    char *p;
  645. X    struct stat statbuf;
  646. X
  647. X    cc = stat(s, &statbuf);
  648. X    if (cc != -1 && ( (statbuf.st_mode & S_IFMT) == S_IFDIR) )
  649. X       strcpy(pattern, "*");
  650. X    else {
  651. X       p = rindex(s, '/');
  652. X       strcpy(pattern, p+1);
  653. X        /* check if we are at the root directory */
  654. X       if (p != s) *p = '\0'; else *(p+1) = '\0';
  655. X    }
  656. X    if (access(s, X_OK)) { *pattern = '\0'; return(-1); }
  657. X    else { strcpy(dir, s); return(0); }
  658. X}
  659. X
  660. X
  661. X/* ARGSUSED */
  662. Xint get_dirpat(s, dir, pattern)
  663. Xchar *s, *dir, *pattern;
  664. X{
  665. X    char *cwd, *p;
  666. X    char directory[255];
  667. X
  668. X    if (s == NULL || !(*s) ) {
  669. X       if ( (cwd = getcwd((char *)NULL, 255)) == (char *)NULL) {
  670. X             disp_message("\ncannot get working directory");
  671. X             return(-1);
  672. X       }
  673. X       else { strcpy(dir, cwd); strcpy(pattern, "*"); return(0); }
  674. X    }
  675. X
  676. X    if (s[0] == '~') {
  677. X        /* expand tilde with the user directory as defined in password
  678. X            file */
  679. X       if ( (p = expand_tilde(s)) == (char *) NULL) return(-1);
  680. X       strcpy(directory, p);
  681. X       XtFree(p);
  682. X    }
  683. X    else if (s[0] == '/') {
  684. X        /* full pathname specified */
  685. X       strcpy(directory, s);
  686. X    }
  687. X    else {
  688. X        /* use the current directory setting */
  689. X       if (strlen(curdirectory) == 1)
  690. X           sprintf(directory, "/%s", s);
  691. X       else sprintf(directory, "%s/%s", curdirectory, s);
  692. X    }
  693. X    return(separate_dirpat(directory, dir, pattern));
  694. X}
  695. X
  696. X
  697. X/* ARGSUSED */
  698. Xint select_file(start, end)
  699. Xint start, end;
  700. X{
  701. X    int i = 0;
  702. X
  703. X    while (i < numfiles && files[i]->d_pos1 <= start) i++; 
  704. X    if ( (files[i-1]->d_pos2 + 1) < end) return(-1);
  705. X    else return(i-1);
  706. X}
  707. X
  708. X/* ARGSUSED */
  709. Xint select_files(start, end, fstart, fend)
  710. Xint start, end;
  711. Xint *fstart, *fend;
  712. X{
  713. X    int i = 0;
  714. X
  715. X    while (i < numfiles && files[i]->d_pos1 < start) i++; 
  716. X    if (i == numfiles) return(-1); else *fstart = i;
  717. X
  718. X    while ( (i < numfiles - 1) && (files[i]->d_pos2 + 1 < end) ) i++;
  719. X
  720. X    *fend = i;
  721. X    return(0);
  722. X}
  723. END_OF_FILE
  724. if test 5872 -ne `wc -c <'list.c'`; then
  725.     echo shar: \"'list.c'\" unpacked with wrong size!
  726. fi
  727. # end of 'list.c'
  728. fi
  729. if test -f 'option.h' -a "${1}" != "-c" ; then 
  730.   echo shar: Will not clobber existing file \"'option.h'\"
  731. else
  732. echo shar: Extracting \"'option.h'\" \(1919 characters\)
  733. sed "s/^X//" >'option.h' <<'END_OF_FILE'
  734. X/*
  735. X * Systems Sciences Laboratory, Webster Research Center
  736. X *
  737. X * Copyright (c) 1988 Xerox Corporation.  All rights reserved.
  738. X *
  739. X * Copyright protection claimed includes all forms and matters of copyrightable
  740. X * material and information now allowed by statutory or judicial lay or
  741. X * herinafter granted, including without limitation, material generated from
  742. X * the software programs which are displayed on the screen such as icons,
  743. X * screen display looks, etc.
  744. X */
  745. X
  746. X
  747. X#ifndef _option_h
  748. X#define _option_h
  749. X
  750. X/***********************************************************************
  751. X *
  752. X * Option Widget (subclassed of Forms widget)
  753. X *
  754. X ***********************************************************************/
  755. X
  756. X/* Parameters:
  757. X
  758. X Name            Class        RepType        Default Value
  759. X ----            -----        -------        -------------
  760. X background             Background    pixel        White
  761. X border        BorderColor    pixel        Black
  762. X borderWidth             BorderWidth    int        1
  763. X destroyCallback         Callback    Pointer        NULL
  764. X height        Height        int        0
  765. X label                 Label        String        NULL
  766. X mappedWhenManaged       MappedWhenManaged  Boolean    True
  767. X maximumLength             Max        int        256
  768. X sensitive             Sensitive    Boolean        True
  769. X orientation        orientation    orientation    XtorientVertical
  770. X width                 Width        int        0
  771. X x                 Position    int        0
  772. X y                 Position    int        0
  773. X
  774. X*/
  775. X
  776. X
  777. X#include <X11/Form.h>
  778. X
  779. X
  780. X#define XtNorientation        "orientation"
  781. X
  782. Xtypedef struct _OptionClassRec    *OptionWidgetClass;
  783. Xtypedef struct _OptionRec    *OptionWidget;
  784. X
  785. Xextern WidgetClass optionWidgetClass;
  786. X
  787. Xextern void XtOptionAddOption(); /* parent, name, set */
  788. X    /* Wiget parent; */
  789. X    /* char *name; */
  790. X    /* Boolean set; */
  791. X            /* of all possible options only one may be selected
  792. X            at a time */ 
  793. X
  794. Xextern int XtOptionGetSelection(); /* widget */
  795. X    /* Widget w; */
  796. X            /* returns the index of the currently selected
  797. X            option; numbered from 1 and in the sequence
  798. X            of creation */
  799. X
  800. X#endif _option_h
  801. X/* DON'T ADD STUFF AFTER THIS #endif */
  802. END_OF_FILE
  803. if test 1919 -ne `wc -c <'option.h'`; then
  804.     echo shar: \"'option.h'\" unpacked with wrong size!
  805. fi
  806. # end of 'option.h'
  807. fi
  808. if test -f 'optionP.h' -a "${1}" != "-c" ; then 
  809.   echo shar: Will not clobber existing file \"'optionP.h'\"
  810. else
  811. echo shar: Extracting \"'optionP.h'\" \(1635 characters\)
  812. sed "s/^X//" >'optionP.h' <<'END_OF_FILE'
  813. X/*
  814. X * Systems Sciences Laboratory, Webster Research Center
  815. X *
  816. X * Copyright (c) 1988 Xerox Corporation.  All rights reserved.
  817. X *
  818. X * Copyright protection claimed includes all forms and matters of copyrightable
  819. X * material and information now allowed by statutory or judicial lay or
  820. X * herinafter granted, including without limitation, material generated from
  821. X * the software programs which are displayed on the screen such as icons,
  822. X * screen display looks, etc.
  823. X */
  824. X
  825. X
  826. X/* Private definitions for option widget */
  827. X
  828. X#ifndef _optiongP_h
  829. X#define _optionP_h
  830. X
  831. X#include "option.h"
  832. X#include "toggle.h"
  833. X#include <X11/FormP.h>
  834. X
  835. Xtypedef struct {int empty;} OptionClassPart;
  836. X
  837. Xtypedef struct _OptionClassRec {
  838. X    CoreClassPart        core_class;
  839. X    CompositeClassPart        composite_class;
  840. X    ConstraintClassPart    constraint_class;
  841. X    FormClassPart        form_class;
  842. X    OptionClassPart        option_class;
  843. X} OptionClassRec;
  844. X
  845. Xextern OptionClassRec optionClassRec;
  846. X
  847. Xtypedef struct _OptionPart {
  848. X    /* resources */
  849. X    String        label;        /* title of option */
  850. X    XtOrientation    orientation;    /* orientation of options */
  851. X    /* private data */
  852. X    Widget        labelW;        /* widget to display description*/
  853. X    int         select;        /* index of currently selected 
  854. X                    toggle widget */
  855. X} OptionPart;
  856. X
  857. Xtypedef struct _OptionRec {
  858. X    CorePart        core;
  859. X    CompositePart    composite;
  860. X    ConstraintPart    constraint;
  861. X    FormPart        form;
  862. X    OptionPart        option;
  863. X} OptionRec;
  864. X
  865. Xtypedef struct {int empty;} OptionConstraintsPart;
  866. X
  867. Xtypedef struct _OptionConstraintsRec {
  868. X    FormConstraintsPart    form;
  869. X    OptionConstraintsPart    option;
  870. X} OptionConstraintsRec, *OptionConstraints;
  871. X
  872. X#endif _optionP_h
  873. END_OF_FILE
  874. if test 1635 -ne `wc -c <'optionP.h'`; then
  875.     echo shar: \"'optionP.h'\" unpacked with wrong size!
  876. fi
  877. # end of 'optionP.h'
  878. fi
  879. if test -f 'toggle.h' -a "${1}" != "-c" ; then 
  880.   echo shar: Will not clobber existing file \"'toggle.h'\"
  881. else
  882. echo shar: Extracting \"'toggle.h'\" \(2032 characters\)
  883. sed "s/^X//" >'toggle.h' <<'END_OF_FILE'
  884. X/*
  885. X * Systems Sciences Laboratory, Webster Research Center
  886. X *
  887. X * Copyright (c) 1988 Xerox Corporation.  All rights reserved.
  888. X *
  889. X * Copyright protection claimed includes all forms and matters of copyrightable
  890. X * material and information now allowed by statutory or judicial lay or
  891. X * herinafter granted, including without limitation, material generated from
  892. X * the software programs which are displayed on the screen such as icons,
  893. X * screen display looks, etc.
  894. X */
  895. X
  896. X#ifndef _XtToggle_h
  897. X#define _XtToggle_h
  898. X
  899. X/***********************************************************************
  900. X *
  901. X * Toggle Widget (subclassed from the Command widget); callback is
  902. X *    ignored
  903. X *
  904. X ***********************************************************************/
  905. X
  906. X#include <X11/CommandP.h>
  907. X
  908. X/* Resources:
  909. X
  910. X Name             Class        RepType        Default Value
  911. X ----             -----        -------        -------------
  912. X background         Background        pixel        White
  913. X border         BorderColor    pixel        Black
  914. X borderWidth         BorderWidth    int        0
  915. X cursor         Cursor        Cursor        hand2
  916. X destroyCallback   Callback        Pointer        NULL
  917. X font             Font        FontStruct    fixed
  918. X foreground         Foreground        pixel        Black
  919. X height         Height        int        text height
  920. X highlightThickness  Thickness        int        2
  921. X insensitiveBorder Insensitive        Pixmap        Gray
  922. X internalHeight    Height        int        2
  923. X internalWidth         Width        int        4
  924. X justify         Justify        Justify        Center
  925. X label             Label        String        NULL
  926. X state             State        State        ToggleOn
  927. X mappedWhenManaged MappedWhenManaged    Boolean        True
  928. X sensitive         Sensitive        Boolean        True
  929. X width             Width        int        text width
  930. X x             Position        int        0
  931. X y             Position        int        0
  932. X
  933. X*/
  934. X
  935. X#ifndef _XtState_e
  936. X#define _XtState_e
  937. X
  938. Xtypedef enum {
  939. X    XtToggleOff = 0,     /* toggle button is off & unset   */
  940. X    XtToggleOn        /* toggle button is on & set  */
  941. X} XtState;
  942. X#endif _XtState_e
  943. X
  944. X#define XtNstate        "state"
  945. X
  946. Xextern WidgetClass    toggleWidgetClass;
  947. X
  948. Xtypedef struct _ToggleClassRec   *ToggleWidgetClass;
  949. Xtypedef struct _ToggleRec        *ToggleWidget;
  950. X
  951. X#endif _XtToggle_h
  952. X/* DON'T ADD STUFF AFTER THIS */
  953. END_OF_FILE
  954. if test 2032 -ne `wc -c <'toggle.h'`; then
  955.     echo shar: \"'toggle.h'\" unpacked with wrong size!
  956. fi
  957. # end of 'toggle.h'
  958. fi
  959. if test -f 'toggleP.h' -a "${1}" != "-c" ; then 
  960.   echo shar: Will not clobber existing file \"'toggleP.h'\"
  961. else
  962. echo shar: Extracting \"'toggleP.h'\" \(1868 characters\)
  963. sed "s/^X//" >'toggleP.h' <<'END_OF_FILE'
  964. X/*
  965. X * Systems Sciences Laboratory, Webster Research Center
  966. X *
  967. X * Copyright (c) 1988 Xerox Corporation.  All rights reserved.
  968. X *
  969. X * Copyright protection claimed includes all forms and matters of copyrightable
  970. X * material and information now allowed by statutory or judicial lay or
  971. X * herinafter granted, including without limitation, material generated from
  972. X * the software programs which are displayed on the screen such as icons,
  973. X * screen display looks, etc.
  974. X */
  975. X
  976. X/* 
  977. X * ToggleP.h - Private definitions for Toggle widget
  978. X * 
  979. X */
  980. X
  981. X#ifndef _XtToggleP_h
  982. X#define _XtToggleP_h
  983. X
  984. X#include "toggle.h"
  985. X#include <X11/CommandP.h>
  986. X
  987. X/***********************************************************************
  988. X *
  989. X * Toggle Widget Private Data
  990. X *
  991. X ***********************************************************************/
  992. X
  993. X/************************************
  994. X *
  995. X *  Class structure
  996. X *
  997. X ***********************************/
  998. X
  999. X
  1000. X   /* New fields for the Command widget class record */
  1001. Xtypedef struct _ToggleClass 
  1002. X  {
  1003. X    int makes_compiler_happy;  /* not used */
  1004. X  } ToggleClassPart;
  1005. X
  1006. X   /* Full class record declaration */
  1007. Xtypedef struct _ToggleClassRec {
  1008. X    CoreClassPart    core_class;
  1009. X    SimpleClassPart    simple_class;
  1010. X    LabelClassPart    label_class;
  1011. X    CommandClassPart  command_class;
  1012. X    ToggleClassPart    toggle_class;
  1013. X} ToggleClassRec;
  1014. X
  1015. Xextern ToggleClassRec toggleClassRec;
  1016. X
  1017. X/***************************************
  1018. X *
  1019. X *  Instance (widget) structure 
  1020. X *
  1021. X **************************************/
  1022. X
  1023. X    /* New fields for the Command widget record */
  1024. Xtypedef struct {
  1025. X    /* resources */
  1026. X    XtState   state;
  1027. X} TogglePart;
  1028. X
  1029. X
  1030. X   /* Full widget declaration */
  1031. Xtypedef struct _ToggleRec {
  1032. X    CorePart        core;
  1033. X    SimplePart        simple;
  1034. X    LabelPart        label;
  1035. X    CommandPart    command;
  1036. X    TogglePart        toggle;
  1037. X} ToggleRec;
  1038. X
  1039. X#define XtCState    "State"
  1040. X#define XtRState    "State"
  1041. X
  1042. X#endif _XtToggleP_h
  1043. X
  1044. X
  1045. END_OF_FILE
  1046. if test 1868 -ne `wc -c <'toggleP.h'`; then
  1047.     echo shar: \"'toggleP.h'\" unpacked with wrong size!
  1048. fi
  1049. # end of 'toggleP.h'
  1050. fi
  1051. if test -f 'xbrowser.icon' -a "${1}" != "-c" ; then 
  1052.   echo shar: Will not clobber existing file \"'xbrowser.icon'\"
  1053. else
  1054. echo shar: Extracting \"'xbrowser.icon'\" \(2276 characters\)
  1055. sed "s/^X//" >'xbrowser.icon' <<'END_OF_FILE'
  1056. X#define xbrowser_width 50
  1057. X#define xbrowser_height 50
  1058. Xstatic char xbrowser_bits[] = {
  1059. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1060. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1061. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0xc0,
  1062. X   0xff, 0x03, 0x00, 0x0c, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xec, 0x00,
  1063. X   0x00, 0x18, 0x0c, 0x04, 0x00, 0x37, 0x00, 0x00, 0xc6, 0x83, 0x87, 0xff,
  1064. X   0x19, 0x07, 0x00, 0x20, 0x78, 0xfc, 0x60, 0xff, 0x01, 0x00, 0x18, 0xcf,
  1065. X   0x03, 0x90, 0xd9, 0x79, 0x00, 0x8c, 0x31, 0xf8, 0xff, 0x0f, 0x0f, 0x00,
  1066. X   0x66, 0x0c, 0xfe, 0xff, 0xdf, 0x07, 0x00, 0x32, 0xc7, 0xff, 0xff, 0x7f,
  1067. X   0x18, 0x00, 0xd9, 0xf1, 0xff, 0xff, 0xff, 0x10, 0x00, 0x64, 0xf8, 0x7f,
  1068. X   0xbf, 0xf6, 0x60, 0x00, 0x10, 0xfe, 0xd7, 0x55, 0xc5, 0x41, 0x00, 0x08,
  1069. X   0x7f, 0xb6, 0xaf, 0xaa, 0x03, 0x00, 0x84, 0x87, 0xea, 0x5f, 0x3d, 0x0f,
  1070. X   0x00, 0xc2, 0x29, 0xbe, 0xbf, 0xca, 0x1f, 0x00, 0xe2, 0xa2, 0xd6, 0x7f,
  1071. X   0x2d, 0x3e, 0x00, 0x7f, 0x08, 0xba, 0xbf, 0xda, 0x7d, 0x00, 0x3f, 0x81,
  1072. X   0x5a, 0x1f, 0x0d, 0xe2, 0x03, 0x3f, 0x2c, 0xbe, 0x4e, 0xca, 0xb9, 0x03,
  1073. X   0x9f, 0x82, 0x54, 0x65, 0x05, 0xe9, 0x00, 0x34, 0x2a, 0xac, 0xaa, 0x86,
  1074. X   0x6c, 0x03, 0xb4, 0x40, 0x59, 0x55, 0x03, 0xae, 0x00, 0x5c, 0x2c, 0xb4,
  1075. X   0xaa, 0x01, 0x53, 0x00, 0xf8, 0x51, 0x61, 0xd5, 0x80, 0x3d, 0x00, 0x50,
  1076. X   0x0f, 0x94, 0x3f, 0x80, 0x68, 0x00, 0x60, 0x9d, 0x15, 0x00, 0x60, 0x8c,
  1077. X   0x00, 0xc0, 0xf2, 0x01, 0x00, 0xbc, 0x87, 0x00, 0x00, 0xaf, 0xff, 0xff,
  1078. X   0x03, 0x0e, 0x00, 0x00, 0x7c, 0x01, 0x00, 0xf0, 0x19, 0x00, 0x04, 0xc0,
  1079. X   0x03, 0x00, 0xfc, 0x30, 0x00, 0x64, 0x00, 0x1e, 0x00, 0x97, 0x01, 0x00,
  1080. X   0x2e, 0x00, 0xe0, 0xff, 0x11, 0x03, 0x00, 0x26, 0x02, 0x00, 0x00, 0x20,
  1081. X   0x06, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x04, 0x00, 0xf2, 0x0e, 0x02,
  1082. X   0x00, 0x20, 0x00, 0x00, 0x12, 0x18, 0x34, 0x00, 0x00, 0x00, 0x00, 0x47,
  1083. X   0x1b, 0xc0, 0xbe, 0x06, 0x40, 0x00, 0xc4, 0x73, 0x06, 0x00, 0x00, 0x7c,
  1084. X   0x00, 0xb4, 0x43, 0xa8, 0xbe, 0xdb, 0x07, 0x00, 0x04, 0x01, 0x00, 0x00,
  1085. X   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0f, 0x00, 0x00, 0x00, 0x00,
  1086. X   0xbf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1087. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1088. X   0x00, 0x00};
  1089. END_OF_FILE
  1090. if test 2276 -ne `wc -c <'xbrowser.icon'`; then
  1091.     echo shar: \"'xbrowser.icon'\" unpacked with wrong size!
  1092. fi
  1093. # end of 'xbrowser.icon'
  1094. fi
  1095. if test -f 'xfilebrowser.h' -a "${1}" != "-c" ; then 
  1096.   echo shar: Will not clobber existing file \"'xfilebrowser.h'\"
  1097. else
  1098. echo shar: Extracting \"'xfilebrowser.h'\" \(5581 characters\)
  1099. sed "s/^X//" >'xfilebrowser.h' <<'END_OF_FILE'
  1100. X/*
  1101. X * Systems Sciences Laboratory, Webster Research Center
  1102. X *
  1103. X * Copyright (c) 1988 Xerox Corporation.  All rights reserved.
  1104. X *
  1105. X * Copyright protection claimed includes all forms and matters of copyrightable
  1106. X * material and information now allowed by statutory or judicial lay or
  1107. X * herinafter granted, including without limitation, material generated from
  1108. X * the software programs which are displayed on the screen such as icons,
  1109. X * screen display looks, etc.
  1110. X */
  1111. X
  1112. X
  1113. X#include <stdio.h>
  1114. X#include <sys/types.h>
  1115. X#include <sys/dir.h>
  1116. X#include <sys/stat.h>
  1117. X
  1118. X#include <X11/Xlib.h>
  1119. X#include <X11/IntrinsicP.h>
  1120. X
  1121. X#include <X11/cursorfont.h>
  1122. X#include <X11/Box.h>
  1123. X#include <X11/Label.h>
  1124. X#include <X11/StringDefs.h>
  1125. X#include <X11/Command.h>
  1126. X#include <X11/VPaned.h>
  1127. X#include <X11/Viewport.h>
  1128. X#include <X11/AsciiTextP.h>
  1129. X#include <X11/Shell.h>
  1130. X#include <X11/Dialog.h>
  1131. X#include "toggle.h"
  1132. X#include "option.h"
  1133. X
  1134. X
  1135. X
  1136. X
  1137. X#define max(a,b) (((a) > (b)) ? (a) : (b))
  1138. X#define min(a,b) (((a) < (b)) ? (a) : (b))
  1139. X
  1140. X#define Feep()            XBell(curdisplay, 20)
  1141. X
  1142. X#define MakeArg(n, v){      args[numargs].name = n;     \
  1143. X                    args[numargs].value = v;    \
  1144. X                    numargs++;             \
  1145. X              }
  1146. X#define MAXNAME 255
  1147. X
  1148. X
  1149. X/* data structures */
  1150. Xtypedef struct _lineelement {
  1151. X    XtTextPosition pa;    /* specifies start position of line */
  1152. X    XtTextPosition pe;    /* specifies end position of line */
  1153. X    int linenumber;        /* line number in text file */
  1154. X    struct _lineelement *next;
  1155. X} LineElement;
  1156. X
  1157. Xtypedef struct _searchelement {
  1158. X    XtTextPosition pos1;    /* specifies start position in widget */
  1159. X    XtTextPosition pos2;    /* specifies end position in widget */
  1160. X    LineElement *lines;    /* list of linenumbers */
  1161. X    char name[MAXNAME + 1];    /* file name */
  1162. X} SearchElement;
  1163. X
  1164. Xstruct afile {
  1165. X    u_short d_marked;    /* file marked for deletion */
  1166. X    char    d_type;        /* file type, e.g. 'd', 'c', 'f' */
  1167. X      u_short d_nl;        /* number of links */
  1168. X      u_short d_uid;        /* owner id */
  1169. X      u_short d_gid;        /* group id */
  1170. X      u_short d_nlink;        /* number of hard links */
  1171. X      char    d_access[12];    /* access rights */
  1172. X      u_long  d_size;        /* file size */
  1173. X      u_long  d_ctime;        /* last modification time */
  1174. X    XtTextPosition d_pos1;    /* start position of display */
  1175. X    XtTextPosition d_pos2;    /* end position of display */    
  1176. X      u_long  d_ino;        /* inode number of entry */
  1177. X      u_short d_reclen;    /* length of this record */
  1178. X      u_short d_namlen;    /* length of string in d_name */
  1179. X      char    d_name[MAXNAME + 1];    /* name must be no longer than this */
  1180. X};
  1181. X
  1182. Xtypedef struct _dialogdata {
  1183. X    Widget w;    /* widget which requested dialog */
  1184. X    int start;    /* index to first selected file in files[] */
  1185. X    int end;    /* index to last selected file in files[] */
  1186. X    int current;    /* index to currently handled file in files[] */
  1187. X    char *answer;    /* dialog provided by user */
  1188. X    Boolean diag;    /* save standard diagnostics */
  1189. X    Boolean out;    /* save standard output */
  1190. X    int (*yes)();    /* yes function */
  1191. X    int (*no)();    /* no function */
  1192. X    int (*cancel)();    /* cancel function */
  1193. X} DialogData;
  1194. X
  1195. X/*
  1196. X * The DIRSIZ macro gives the minimum record length which will hold
  1197. X * the directory entry.  This requires the amount of space in struct direct
  1198. X * without the d_name field, plus enough space for the name with a terminating
  1199. X * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  1200. X */
  1201. X
  1202. X#define MYDIRSIZ(dp, length) \
  1203. X    ((sizeof (struct afile) - (MAXNAME+1)) + \
  1204. X        (((dp)->d_namlen+1 + 3 + length) &~ 3))
  1205. X
  1206. X
  1207. X/*    misc externs     */
  1208. Xextern char *XtMalloc();
  1209. Xextern char *XtRealloc();
  1210. Xextern char *XtCalloc();
  1211. Xextern char *index();
  1212. Xextern char *rindex();
  1213. Xextern char *getcwd();
  1214. X
  1215. X
  1216. X/*    externs in xfilebrowser.c    */
  1217. Xextern char *filepattern;
  1218. Xextern char *searchpattern;
  1219. Xextern char *curdirectory;
  1220. Xextern char *oldpattern;
  1221. Xextern char *cmdline;
  1222. Xextern int viewEdit;
  1223. X
  1224. Xextern struct afile **files;
  1225. Xextern int numfiles;
  1226. Xextern SearchElement **hitfiles;
  1227. Xextern int numhitfiles;
  1228. Xextern int allowedit;
  1229. X
  1230. Xextern Widget toplevel;
  1231. Xextern Widget outer;
  1232. Xextern Widget messwidget;
  1233. Xextern Widget listwidget;
  1234. Xextern Widget dirwidget;
  1235. Xextern Widget fpatwindow;
  1236. Xextern Widget grepwidget;
  1237. X
  1238. XWidget quitbutton;    /* command button for quit */
  1239. XWidget listbutton;    /* command button for list */
  1240. XWidget editbutton;    /* command button for edit file selected
  1241. X            in directory listing */
  1242. XWidget parentdirbutton;    /* command button for selecting
  1243. X                parent directory */
  1244. XWidget shellbutton;    /* command button for invoking shell */
  1245. XWidget copybutton;    /* command button for invoking copy */
  1246. XWidget renamebutton;    /* command button for invoking rename */
  1247. XWidget deletebutton;    /* command button for invoking delete on files */
  1248. X
  1249. XWidget grepbutton;    /* command button for invoking grep on files */
  1250. XWidget grepwindow;    /* string box to specify the grep search pattern */
  1251. XWidget grepeditbutton;    /* command button for edit file selected
  1252. X            in list of searched files */
  1253. X
  1254. Xextern Display *curdisplay;
  1255. Xextern XtTextSource messsource, listsource, grepsource;
  1256. X
  1257. X/*    externals in util.c     */
  1258. Xextern Widget makeCommandButton();
  1259. Xextern Widget makeBooleanButton();
  1260. Xextern Widget makeStringBox();
  1261. Xextern int select_file();
  1262. Xextern char *expand_tilde();
  1263. X
  1264. X/*    externs in commands.c     */
  1265. Xextern DoQuit();
  1266. Xextern DoList();
  1267. Xextern DoEdit();
  1268. Xextern DoGrep();
  1269. Xextern DoChangeDir();
  1270. Xextern DoShell();
  1271. Xextern DoParent();
  1272. Xextern DoGrepEdit();
  1273. Xextern DoCopy();
  1274. Xextern DoRename();
  1275. Xextern DoDelete();
  1276. X
  1277. X/*    externs in ap.c     */
  1278. Xextern XtTextSource TCreateApAsSource();
  1279. X
  1280. X/*    externs in popup.c     */
  1281. Xextern int create_confirm();
  1282. Xextern int confirm_prompt();
  1283. Xextern int check_confirm();
  1284. Xextern int check_prompt();
  1285. X
  1286. X/*    externs in scandir.c    */
  1287. Xextern int check_option();
  1288. Xextern int currentid;
  1289. X
  1290. END_OF_FILE
  1291. if test 5581 -ne `wc -c <'xfilebrowser.h'`; then
  1292.     echo shar: \"'xfilebrowser.h'\" unpacked with wrong size!
  1293. fi
  1294. # end of 'xfilebrowser.h'
  1295. fi
  1296. echo shar: End of archive 3 \(of 3\).
  1297. cp /dev/null ark3isdone
  1298. MISSING=""
  1299. for I in 1 2 3 ; do
  1300.     if test ! -f ark${I}isdone ; then
  1301.     MISSING="${MISSING} ${I}"
  1302.     fi
  1303. done
  1304. if test "${MISSING}" = "" ; then
  1305.     echo You have unpacked all 3 archives.
  1306.     rm -f ark[1-9]isdone
  1307. else
  1308.     echo You still need to unpack the following archives:
  1309.     echo "        " ${MISSING}
  1310. fi
  1311. ##  End of shell archive.
  1312. exit 0
  1313. -- 
  1314. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  1315. Moderator of comp.sources.x
  1316.